"use strict";
cc._RF.push(module, '77958Y4pOpPUKgMb9x5YifD', 'AudioManager');
// Script/SdkTools/AudioManager.ts

"use strict";
/**
 * 音效，音乐管理工具
 */
Object.defineProperty(exports, "__esModule", { value: true });
var gamePrefabMgr_1 = require("./gamePrefabMgr");
var gameStorage_1 = require("./gameStorage");
var AudioManager = /** @class */ (function () {
    function AudioManager() {
    }
    AudioManager.setSoundEvent = function () {
        cc.director.on('main_bg', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.stopMusic();
            cc.audioEngine.playMusic(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.main_bg], true);
        }, this);
        cc.director.on('game_bg0', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.stopMusic();
            cc.audioEngine.playMusic(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.main_bg], true);
        }, this);
        cc.director.on('game_bg1', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.stopMusic();
            cc.audioEngine.playMusic(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.main_bg], true);
        }, this);
        cc.director.on('game_bg2', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.stopMusic();
            cc.audioEngine.playMusic(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.main_bg], true);
        }, this);
        cc.director.on('game_bg3', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.stopMusic();
            cc.audioEngine.playMusic(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.main_bg], true);
        }, this);
        cc.director.on('answerright', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.playEffect(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.answerright], false);
        }, this);
        cc.director.on('error', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.playEffect(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.error], false);
        }, this);
        cc.director.on('fail', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.playEffect(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.fail], false);
        }, this);
        cc.director.on('win', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.playEffect(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.win], false);
        }, this);
        cc.director.on('hit', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.playEffect(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.hit], false);
        }, this);
        cc.director.on('click', function () {
            if (gameStorage_1.default.getMusic() == 1)
                return;
            cc.audioEngine.playEffect(gamePrefabMgr_1.default.Instance.soundRes[gamePrefabMgr_1.soundName.click], false);
        }, this);
    };
    return AudioManager;
}());
exports.default = AudioManager;

cc._RF.pop();